set servicefilepath=E:\mozhi\smarterp\services\

echo check mozhi_smarterp_authorservice is exist
SC QUERY mozhi_smarterp_authorservice> NUL
IF ERRORLEVEL 1060 GOTO NOTEXIST
GOTO EXIST
:NOTEXIST
::install service
nssm install mozhi_smarterp_authorservice "%servicefilepath%\authorservice\src\mozhi.smarterp.AuthorCenter.HttpApi.Host\bin\Debug\net6.0\mozhi.smarterp.AuthorCenter.HttpApi.Host.exe" --urls "http://localhost:44336"
:EXIST
:: stop service
nssm stop mozhi_smarterp_authorservice

echo check mozhi_smarterp_basicdata is exist
SC QUERY mozhi_smarterp_basicdata> NUL
IF ERRORLEVEL 1060 GOTO NOTEXIST
GOTO EXIST
:NOTEXIST
::install service
nssm install mozhi_smarterp_basicdata "%servicefilepath%\basicdataservice\host\mozhi.smarterp.BasicData.HttpApi.Host\bin\Debug\net6.0\mozhi.smarterp.BasicData.HttpApi.Host.exe" --urls "http://localhost:44338"
:EXIST
:: stop service
nssm stop mozhi_smarterp_basicdata


echo check mozhi_smarterp_business is exist
SC QUERY mozhi_smarterp_business> NUL
IF ERRORLEVEL 1060 GOTO NOTEXIST
GOTO EXIST
:NOTEXIST
::install service
nssm install mozhi_smarterp_business "%servicefilepath%\businessservice\host\mozhi.smarterp.Business.HttpApi.Host\bin\Debug\net6.0\mozhi.smarterp.Business.HttpApi.Host.exe" --urls "http://localhost:44384"
:EXIST
:: stop service
nssm stop mozhi_smarterp_business

pause
